﻿@using Quiz.Model;
@using Quiz.Player.Controllers;
@model Quiz.Model.Question

@{
    ViewBag.Title = "Create Questions";
    QuestionType tp =( Model== null || string.IsNullOrEmpty( Model.QuestionType))? 
        QuestionType.MCQ4: QuestionType.PlainText;
    ViewBag.Menu = "Play.Index";
}

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Question</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.QuestionText)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.QuestionText)
            @Html.ValidationMessageFor(model => model.QuestionText)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.QuestionType)
        </div>
        <div class="editor-field">
            @Html.DropDownList("QuestionType",  tp.ToSelectList("MCQ4"))
        </div>
       
        <div class="editor-field">           
            @Html.HiddenFor(model => model.AnswerDom)
            @Html.ValidationMessageFor(model => model.AnswerDom)
             <input type="submit" name="answer" value="Add Answers" />
        </div>

        <div class="editor-field">
            @Html.HiddenFor(model => model.AnswerRowID)
            @Html.ValidationMessageFor(model => model.AnswerRowID)
            @Html.HiddenFor(model => model.RowKey)
        </div>
    </fieldset>
}

<div>
   @{
        var listPage = Url.Action("Index");
    }
  <button onclick="window.location.href='@listPage'">Go To List</button>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
